<%@ page import= "modelo.Aluno" %>
<%@ page import= "java.util.Vector" %>
<html> <head></head> 
  <body>
 
    <form action = "ControlaAluno" method = "get">
      <%  Vector turma;
	  turma = (Vector) request.getSession().getAttribute("Turma01");  
          String indice = request.getParameter("registro");
	  String operacao = request.getParameter("operacao"); 	
          Aluno aluno = new Aluno();
            
      if (operacao.equals("1")) {
    		aluno.setNome("");
 	} else {
         	int ind = Integer.parseInt(indice);
         	aluno = (Aluno)turma.get(ind);
 	}
 %>
  <table border="1" width="50%">
    <tr>
       <th COLSPAN="2"> DADOS DO ALUNO </th>
    </tr>
    <tr>
      <td>Nome Aluno: </td>
      <td><input name="txtNomeAluno" value="<%=aluno.getNome()%>" size="30"></td>
    </tr>
    <tr>
      <td>Nota A1: </td>
      <td><input name="txtNota1" value="<%= aluno.getNota1() %>" size="10"> </td>
    </tr>
    <tr>
      <td>Nota A2: </td>
      <td><input name="txtNota2" value="<%= aluno.getNota2() %>" size="10"> </td>
    </tr> 
  </table>
      <br>
      <%
        	if (operacao.equals("1")) {
      %> 
           <input type="submit" value="Incluir Aluno" onclick="this.form.operacao.value=3">

          <%  } else {   %>
                <input type="submit" value="Alterar Aluno" onclick="this.form.operacao.value=4" >
                <input type="submit" value="Excluir Aluno" onclick="this.form.operacao.value=5" >
        <%  }   %>

	<input type="hidden" name="operacao"  value ="" >
        	<input type="hidden" name="registro"  value = <%=indice%> >           
    </form>
    <p>  <h3>Retornar a lista de aluno  
		<a href="ControlaAluno?operacao=0">clique aqui</a></h3>

 </body> 
</html> 
      